/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package code;

import com.sun.jersey.api.container.httpserver.HttpServerFactory;
import com.sun.net.httpserver.HttpServer;
import java.io.IOException;
import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;

/**
 *
 * @author Renato Rosa <2101076@my.ipleiria.pt>
 */
@Path("/mostrador")
public class RESTUpdater {
    
    static final String BASE_URI = "http://localhost:4444/";
    
    @GET
    @Path("/test")
    @Produces(MediaType.APPLICATION_JSON)
    public Response get(){
        String result = "OK";
	return Response.status(201).entity(result).build();
    }
    
    @POST
    @Path("/update")
    @Consumes(MediaType.APPLICATION_XML)
    public Response updateMostrador(InfoFilaEspera info[]){
        String result = "OK";
	return Response.status(201).entity(result).build();
    }
    
    
 
    public static void main(String[] args) {
        try {
            HttpServer server = HttpServerFactory.create(BASE_URI);
            server.start();
            System.out.println("Press Enter to stop the server. ");
            System.in.read();
            server.stop(0);
        } catch (IllegalArgumentException | IOException e) {
            e.printStackTrace();
        }
    }
    
}
